package Thread;
//守护线程  后台线程
public class DaemonDemo {
    public static void main(String[] args) {
        Thread rose=new Thread(){
            public void run(){
                for (int i=0;i<5;i++){
                    System.out.println("rose 我要跳船");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("啊啊啊啊啊啊啊啊");
                System.out.println("噗通。。。。");
            }
        };
        Thread jack=new Thread(){
          public void run(){
              while (true){
                  System.out.println("jack:誓死追随");
                  try {
                      Thread.sleep(1000);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
              }
          }
        };
        jack.setDaemon(true);

        rose.start();
        jack.start();

        while (true);

    }
}
